package com.cman777.springc.common.helper;

import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.core.env.Environment;

/**
 * @author chenzhicong
 * @time 2019/12/13 15:30
 * @description
 */
public class EnvHelper implements ApplicationContextAware {

    private static boolean isOnline;


    public static boolean isOnline(){
        return isOnline;
    }


    @Override
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
         Environment environment = applicationContext.getEnvironment();
        //是否线上环境
        isOnline = EnvUtil.isOnline(environment);
    }
}
